package org.check.UI;

import java.awt.Color;

import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EtchedBorder;
import javax.swing.event.CaretListener;
import javax.swing.event.CaretEvent;

public class IDFilterPanel extends JPanel {

	private JTextField text_filter;
	private String filterText;

	/**
	 * Create the panel.
	 */
	public IDFilterPanel() {
		setLayout(null);
		setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
		setBackground(Color.LIGHT_GRAY);

		text_filter = new JTextField();
		text_filter.addCaretListener(new CaretListener() {

			public void caretUpdate(CaretEvent e) {
				setFilterText(text_filter.getText());
			}
		});
		text_filter.setText("%");
		text_filter.setColumns(10);
		text_filter.setBounds(10, 10, 142, 21);
		add(text_filter);
	}

	public String getFilterText() {
		return filterText;
	}

	public void setFilterText(String filterText) {
		this.filterText = filterText;
	}
	
	public String filterCourseId() {
		return text_filter.getText() == null ? "" : text_filter.getText();
	}

}
